<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>微信支付</title>
</head>
<body>

</body>
<script src="__ROOT__/static/swiper/jquery.js" type="text/javascript"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="__ROOT__/static/layer_mobile/layer.js" type="text/javascript"></script>
<script type="text/javascript">
    var top_id = {$top_id};

    function onBridgeReady() {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId": "{$pay_data['appId']}",                   //公众号名称，由商户传入
                "timeStamp": "{$pay_data['timeStamp']}",           //时间戳，自1970年以来的秒数
                "nonceStr": "{$pay_data['nonceStr']}",             //随机串
                "package": "{$pay_data['package']}",
                "signType": "{$pay_data['signType']}",             //微信签名方式：
                "paySign": "{$pay_data['paySign']}"                //微信签名
            },
            function (res) {
                console.log(res);
                return;
                /*                if (res.err_msg == "get_brand_wcpay_request:ok") {
                                    var url = "{:url('Mobile/Order/paySuccess',array('id'=>'order_id_tips'))}";
                                    url = url.replace('order_id_tips', top_id);
                                    window.location.href = url;
                                } else if (res.err_msg == 'get_brand_wcpay_request:fail') {
                                    layer.open({
                                        content: '支付失败请重新支付~',
                                        btn: '我知道了',
                                        yes: function (index) {
                                            layer.close(index);
                                            window.location.href = "{:url('Mobile/Product/orderList',array('order_type'=>0))}";
                                        }
                                    });
                                } else {
                                    window.location.href = "{:url('Mobile/Product/orderList',array('order_type'=>0))}";
                                }*/
            }
        );
    }

    if (typeof WeixinJSBridge == "undefined") {
        if (document.addEventListener) {
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        } else if (document.attachEvent) {
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    } else {
        onBridgeReady();
    }
</script>
</html>